package com.syni.mdd.sjb.common.datatreaure.controller.protect;


import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckUserIdentity;
import com.syni.mdd.sjb.common.component.utils.common.utils.ResultMapHelper;
import com.syni.mdd.sjb.common.datatreaure.controller.BaseController;
import com.syni.mdd.sjb.common.datatreaure.constants.ResultMsg;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.industry.GetAllIndustryVo;
import com.syni.mdd.sjb.common.datatreaure.service.DxshAppIndustryService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 电享生活行业表 前端控制器
 * </p>
 *
 * @author cfx
 * @since 2020-04-24
 */
@RestController
@RequestMapping("/industry")
public class DxshAppIndustryController extends BaseController {

    @Autowired
    DxshAppIndustryService dxshAppIndustryService;

    @PostMapping("getAllIndustry")
    @ApiOperation(value = "获取所有行业")
    @CheckUserIdentity
    public Map<String,Object> getAllIndustry(@RequestBody @Validated GetAllIndustryVo getAllIndustryVo){
        return dxshAppIndustryService.getAllIndustry(getAllIndustryVo);
    }

    @PostMapping("/chooseIndustry")
    @ApiOperation(value = "觅东东数据宝选择行业")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "industryId",value = "行业id")})
    @CheckUserIdentity
    public Map<String,Object> chooseIndustry(@RequestBody @Validated GetAllIndustryVo getAllIndustryVo){
        dxshAppIndustryService.chooseIndustry(getAllIndustryVo.getUserId(),getAllIndustryVo.getIndustryId());
        return ResultMapHelper.success(null, ResultMsg.HAND_SUCCESS);
    }

    @PostMapping("/getBusinessType")
    @ApiOperation(value = "觅东东数据宝行业下的具体店铺类型")
    @CheckUserIdentity
    public Map<String,Object> getBusinessType(@RequestBody @Validated GetAllIndustryVo getAllIndustryVo){
        return dxshAppIndustryService.getBusinessType(getAllIndustryVo.getUserId());
    }

}
